﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace Delivery.Utils
{
    public class FileSystem
    {
        private string path = Application.StartupPath + "\\system_config.xml";
        private string system_config;
        private string line;
        public FileSystem()
        { 
        }

        public string Read_File()
        {
            line = null;
            try
            {

                FileStream fs = new FileStream(path, FileMode.Open);
                StreamReader sr = new StreamReader(fs);
                while ((line = sr.ReadLine()) != null)
                {
                    system_config = line;
                }
                sr.Close();
                fs.Close();
                return system_config;
            }
            catch (Exception)
            {
                return "0";
            }
        }
        public void Write_File(string str)
        {
            try
            {
                FileStream fs = new FileStream(path, FileMode.Create);
                StreamWriter sw = new StreamWriter(fs);
                sw.WriteLine(str);
                sw.Flush();
                sw.Close();
                fs.Close();
            }
            catch (Exception)
            {
            }
        }
    }
}
